package vip.finance.makemoney.config.exception;

import vip.finance.makemoney.common.RestEnum;

/**
 * @author yangbin
 * @date 2023年02月01日
 */
public class BusinessException extends RuntimeException {
    private int status;
    private String msg;

    public BusinessException(String msg) {
        this.status = RestEnum.SERVICE_ERROR.getStatus();
        this.msg = msg;
    }

    public BusinessException(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public BusinessException(RestEnum restEnum) {
        this.status = restEnum.getStatus();
        this.msg = restEnum.getMessage();
    }

    public BusinessException(RestEnum restEnum, String msg) {
        this.status = restEnum.getStatus();
        this.msg = msg;
    }

    public int getStatus() {
        return status;
    }

    public String getMsg() {
        return msg;
    }

    @Override
    public String toString() {
        return "BusinessException{" +
                "status=" + status +
                ", msg='" + msg + '\'' +
                '}';
    }
}
